x86: allow 64-bit PV guest kernels to suppress user mode exposure of M2P
authorJan Beulich <jbeulich@suse.com>
Tue, 5 May 2015 16:01:33 +0000 (18:01 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 5 May 2015 16:01:33 +0000 (18:01 +0200)
commitd72a4605e18d3a61c4469ff092dbbbfa4ac919f7
treefb2340dc835ad1d7a2e21d46a416d33176cf2f3d
parent017e667c433a1040306db6265b05e104568c70c8
x86: allow 64-bit PV guest kernels to suppress user mode exposure of M2P

Xen L4 entries being uniformly installed into any L4 table and 64-bit
PV kernels running in ring 3 means that user mode was able to see the
read-only M2P presented by Xen to the guests. While apparently not
really representing an exploitable information leak, this still very
certainly was never meant to be that way.

Building on the fact that these guests already have separate kernel and
user mode page tables we can allow guest kernels to tell Xen that they
don't want user mode to see this table. We can't, however, do this by
default: There is no ABI requirement that kernel and user mode page
tables be separate. Therefore introduce a new VM-assist flag allowing
the guest to control respective hypervisor behavior:
- when not set, L4 tables get created with the respective slot blank,
  and whenever the L4 table gets used as a kernel one the missing
  mapping gets inserted,
- when set, L4 tables get created with the respective slot initialized
  as before, and whenever the L4 table gets used as a user one the
  mapping gets zapped.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/domain.c
xen/arch/x86/domain_build.c
xen/arch/x86/mm.c
xen/arch/x86/mm/shadow/multi.c
xen/arch/x86/x86_64/mm.c
xen/include/asm-x86/config.h
xen/include/asm-x86/mm.h
xen/include/public/xen.h